home *** CD-ROM | disk | FTP | other *** search
/ NeXT Education Software Sampler 1992 Fall / NeXT Education Software Sampler 1992 Fall.iso / Programming / Source / HippoDraw / HippoDrawSrc1.1 / Hippo.subproj / HGraphicView.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-04-25  |  7.7 KB  |  301 lines

  1. /* Hippo Graphic View    by Paul Kunz    June 1991
  2.  * a subclass of GraphicView in /NextDeveloper/Examples/Draw
  3.  * to add or over-ride so that it can handle hippo Graphic objects
  4.  *
  5.  * Copyright (C)  1991  The Board of Trustees of
  6.  * The Leland Stanford Junior University.  All Rights Reserved.
  7.  */
  8.  
  9. #define HGRAPHICVIEW_H_ID "$Id: HGraphicView.h,v 1.41 1992/04/19 04:13:33 pfkeb Rel $"
  10.  
  11. #import "GraphicView.h"
  12.  
  13. #import "hippo.h"
  14.  
  15. @interface HGraphicView : GraphicView
  16. {
  17.     id        prefPanel;    /* the Preferences Panel */
  18.     id        prefForm;    /* Preferences Panel Form */
  19.     id        hDraw;        /* global drawing controler object */
  20.     id         tupleList;    /* List used for archiving & closing */
  21.     id        plotList;    /* List of Plot objects */
  22.     id        cutList;    /* List of Plot objects that display Cuts */
  23.     display    *dispList;    /* list of displays */
  24. }
  25. /* The following methods over-ride the super class */
  26. + initialize;
  27.  /*
  28.   * Registers the defaults
  29.   */
  30.   
  31. + convert:(NXTypedStream *)ts to:(const char *)type using:(SEL)writer toPasteboard:pb;
  32.  /*
  33.   * over ride method from super class inorder to make this class
  34.   * a scrapper
  35.   */
  36.   
  37. - initFrame:(const NXRect *)frameRect;
  38.  /*
  39.   * Designated initializer for class.
  40.   */
  41.   
  42. - (BOOL)validateCommand:menuCell;
  43.  /*
  44.   * Invoked with menuCell by autoupdate mechanism.   Returns YES
  45.   * if menuCell's action is valid for selected Graphic(s).
  46.   */
  47.   
  48. - delete:sender;
  49.  /*
  50.   * Delete selected Graphic objects, but check if any are Plot objects
  51.   * displaying a cut.   If so, prompt user first.
  52.   */
  53.  
  54. - cut:sender;
  55.  /*
  56.   * Cut selected Graphic objects, but check if any are Plot objects
  57.   * displaying a cut.   If so, prompt user first.
  58.   */
  59.  
  60. - (BOOL) isAllowed;
  61.  /* A private method to support cut: and delete: methods. 
  62.   * Checks if any selected graphic is a cutPlot.  Returns
  63.   * YES if cut: or delete: method can proceed
  64.   */
  65.   
  66. /* The following methods are extensions for Hippo */
  67. - addPlotOfType:(int) type;
  68.  /*
  69.   * Creates and adds a new Plot of specified type to the GraphicView,
  70.   * selects it and returns the newly created plot.
  71.   * The type corresponds to the hippo graphtype_t
  72.   * 
  73.   * See also: -addPlotOfType:andSelect:
  74.   */
  75.   
  76. - addPlotOfType:(int) type andSelect:(BOOL) selFlag;
  77.  /*
  78.   * Creates and adds a new Plot of specified type to the GraphicView
  79.   * and returns the newly created plot.
  80.   * The type corresponds to the hippo graphtype_t
  81.   * If selFlag is YES then
  82.   * also selects the newly created plot and brings front the
  83.   * data selection inspector.
  84.   *
  85.   * See also: -addPlotOfType:
  86.   */
  87.  
  88. - hTupleForFile:(const char *)filename index:(int) iValue;
  89.  /*
  90.   * Returns the HTuple object that contains the iValue-th ntuple in
  91.   * file filename, or nil if none found.
  92.   */
  93.   
  94. - setTuple:(ntuple) nt withNewDisplay:(int) dim;
  95.   /*
  96.    * Creates a new Plot graphic and display with dimension dim with
  97.    * tuple nt, and inserts it into the view.
  98.    */
  99.    
  100. - addCut:plot;
  101.  /*
  102.   * Adds the Plot plot to the Cut Plot list.   Used with pasting a
  103.   * cut plot.
  104.   */
  105.   
  106. - placeDisplay:(id) plot select:(int) sel;
  107.   /*
  108.    * given a new plot, put it on the page in a reasonable place.
  109.    * resize the document only by page steps.
  110.    * if sel is true, select the plot; otherwise don't.
  111.    */
  112.  
  113. - addPage:sender;
  114.   /*
  115.    * extend the document by 1 page and move all the objects up.
  116.    */
  117.  
  118. - saveAsExportFile:(const char *)filename;
  119.   /*
  120.    * Saves all displays and ntuples as the export file filename.  That is,
  121.    * save them as a pure Hippo file and ignore and additional graphic
  122.    * objects.
  123.    */
  124.    
  125. - (display *) displayList;
  126.   /*
  127.    * returns a NULL terminated list of hippo displays that were collected
  128.    * during archiving the view.
  129.    */
  130.    
  131. - plotList;
  132.  /*
  133.   * Returns a List object that contains all Plot objects in the view.
  134.   */
  135.   
  136. - cutList;
  137.  /*
  138.   * Returns a List object that contains Plot objects which support
  139.   * displays of Cuts.
  140.   */
  141.   
  142. - firstPlot;
  143.  /*
  144.   * Returns the Plot object is only one is selected or
  145.   * returns the first Plot of a Overlay group, if only one is selected.
  146.   */
  147.   
  148. - reDrawPlot;
  149.   /* reDraws the plots.   Temporary method until each plot modification
  150.   * method is implemented as graphicPerform style method.
  151.   */
  152.   
  153. - graphicsPerformNOP: g;
  154.  /*
  155.   * caches extended bounds of single graphic g
  156.   */
  157.   
  158. - graphicsPerform:(SEL)aSelector with:(void *)argument
  159.                    andDraw:(BOOL)flag inList:aList;
  160.  /*
  161.   * Sends message aSelector with argument argument to graphic objects
  162.   * in List aList.   If flag is YES, redraws the graphic.
  163.   */
  164.   
  165. - graphicsPerform:(SEL)aSelector with:arg1 with:arg2;
  166.  /*
  167.   * Sends message aSelector with arguments arg1 and arg2.
  168.   */
  169.   
  170. - currentGraphic;
  171.   /* over-ride method to use instance of HDraw to get current graphic
  172.   */
  173.   
  174. - alignAll:sender;
  175.  /*
  176.   * Aliases for -overlay: method.   Kept temporarily for
  177.   * backward compatiblity.
  178.   */
  179.    
  180. - overlay:sender;
  181.  /*
  182.   * Forms an Overlay Group from the selected Graphics.
  183.   */
  184.   
  185. - unoverlay:sender;
  186.  /*
  187.   * Un-does an Overlay Group.
  188.   */
  189.   
  190. - alignSize:sender;
  191.  /*
  192.   * Aliases for -overlay: method.   Kept temporarily for
  193.   * backward compatiblity.
  194.   */
  195.   
  196. - alignXRange:sender;
  197.   /* Forces all selected Plots to accept the X range of the first 
  198.    * selected plot
  199.    */
  200.    
  201. - alignYRange:sender;
  202.   /* Forces all selected Plots to accept the Y range of the first 
  203.    * selected plot if the first selected Plot is  not a 1D plot.
  204.    */
  205.    
  206. - alignXNumBins:sender;
  207.   /* Forces all selected Plots to accept the number of bins on the X
  208.    * axis of the first selected plot.
  209.    */
  210.  
  211. - alignYNumBins:sender;
  212.   /* Forces all selected Plots to accept the number of bins on the Y
  213.    * axis of the first selected plot if that plot is not 1D plot.
  214.    */
  215.  
  216. - copyPSToPasteboard:pboard;
  217.   /* Copies only the PostScript code to the pasteboard
  218.   */
  219.   
  220. - pasteFromPasteboard:pboard;
  221.  /*
  222.   * Pastes any type available from the specified Pasteboard into the
  223.   * GraphicView.
  224.   * If the type in the Pasteboard is the internal type, then the objects
  225.   * are simply added to the slist and glist.  If it is PostScript or TIFF,
  226.   * then an Image object is created using the contents of
  227.   * the Pasteboard.  If object is a Plot, then binds the plot by
  228.   * reference to the tuple.
  229.   * Returns a list of the pasted objects (which should be freed
  230.   * by the caller).
  231.   */
  232. - writePSToStream:(NXStream *)stream;
  233.  /* 
  234.   * over-rides method in super class in order to bind displays
  235.   */
  236.   
  237. - bindDisplays;
  238.   /*
  239.    * Binds all the displays to their ntuples.   This method is called
  240.    * opening a document after both the Plot object and ntuple file
  241.    * have been read.
  242.    */
  243.  
  244. - bindDisplaysInList:list;
  245.   /*
  246.    * Binds any displays contained in Plot objects in the list list 
  247.    * to their ntuples.   This is a private method used for both
  248.    * opening documents and pasting from the PasteBoard.
  249.    */ 
  250. - tupleList;
  251.   /*
  252.    * Returns a List object containing the HTuple objects needed
  253.    * for the Plots in the View.
  254.    */
  255.    
  256. - replace:oldTuple with:newTuple;
  257.  /*
  258.   * Receiving view replaces oldTuple with newTuple for plots in its view.
  259.   */
  260.   
  261. - closeTupleFile:(const char *) filename;
  262.   /*
  263.    * Informs each Plot object in the view that references n-tuple
  264.    * in the file filename, that the file is closed.
  265.    */
  266.    
  267. - openTuple:pasteBoard
  268.     userData:(const char *)args
  269.     error:(char **)errorMsg;
  270.   /*
  271.    * Method for reading ascii n-tuple from pasteboard
  272.    */
  273.    
  274. - calcDefaultPlotSize:(NXRect *) bbox;
  275.  /*
  276.   * Calculates the default plot size and returns it via
  277.   * the argument.
  278.   */
  279.   
  280. - prefPanel:sender;
  281.  /*
  282.   * Brings up Preferences Panel
  283.   */
  284.   
  285. - prefButton:sender;
  286.  /*
  287.   * Responds to either preference Panel button.
  288.   */
  289.   
  290. - write:(NXTypedStream *)stream;
  291.   /*
  292.    * Writes the HGraphicView object to NXTypedStream stream.
  293.    */
  294.    
  295. - read:(NXTypedStream *)stream;
  296.   /*
  297.    * Reads the HGraphicView object from the NXTypedStream stream.
  298.    */
  299.    
  300. @end
  301.